import mapper.ArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import po.Article;
import service.SearchServiceImpl;

import java.util.ArrayList;
import java.util.List;

public class Main2 {



    public static void main(String[] args) {
        //测试配置文件
        ApplicationContext ctx=new ClassPathXmlApplicationContext("spring/applicationContext-dao.xml");

        ArticleMapper articleMapper=(ArticleMapper) ctx.getBean("articleMapper");
        Article article = new Article();

//
//        try {
//            article = articleMapper.searchId(1);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
//        String dateTime = df.format(article.getDate()); // Formats a Date into a date/time string.
//        System.out.println(dateTime);




//        article.setTitle("assadasd");
//        try {
//            articleMapper.insertArticle(article);
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

//        List<Article> testList = new ArrayList<>();
//        try {
//            testList= articleMapper.searchAllArticles();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

    }
}
